package collection;

import java.util.ArrayList;

public class CollectionDemo3 {
    public static void main(String[] args) {
        User u1 = new User("jack",22);
        User u2 = new User("tom",21);
        ArrayList<User> list  = new ArrayList<>();
        list.add(u1);
        list.add(u2);
        for(User u : list){
            System.out.println(u);
        }
        for (User user : list) {
            System.out.println(user.getAge());
        }


    }
}
